<template>
  <div class="water2">
    <div class="box">
      <waterfall :col="1" :data="waterfallArr">
        <div class="img" v-for="(item, index) in waterfallArr" :key="index" @click="goAdeio(video[index].url,item.title,item.onlineTime)">
          <div class="yugao">
            <div class="yu" ref="waterfallItem">
              <img class="auto-img" :src="video[index].imgUrl" v-lazy="video[index].imgUrl" />
              <div class="title two-text">{{ item.title }}</div>
              <div class="di">
                <div class="di1">
                  <div class="tou">
                    <img class="auto-img" :src="item.user.avatarurl" alt="" v-lazy="item.user.avatarurl" />
                  </div>
                  <div class="text one-text">{{ item.user.nickName }}</div>
                </div> 
                <div class="di1">
                  <div class="dimg"><van-icon name="like-o" /></div>
                  <div class="dsum">{{ item.upCount }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </waterfall>
    </div>
  </div>
</template>

<script>
export default {
  name: "Water2",
  data() {
    return {
      waterfallArr: [],
      video: [],
    };
  },
  created() {
    this.getYugao();
  },
  methods: {
    getYugao() {
      this.axios({
        method: "get",
        url: "https://apis.netstart.cn/maoyan/video/short/0",
      })
        .then((result) => {
          this.$toast("加载成功！");
          this.waterfallArr = result.data.data.feeds;
          this.waterfallArr.forEach((v) => {
            this.video.push(v.video);
          });
          // 
          
        })
        .catch((err) => {
          
        });
    },
    goAdeio(url,title,time){
      this.$router.push({ name: "Adeio", params: { url,title,time } });
    }
  },
};
</script>

<style lang="less" scoped>
body {
  margin: 0 auto;
}

.water2{
  width: 100%;
  margin-bottom: 55px;
}

.box {
  width: 100%;
  column-count: 2;
  column-gap: 10px;
  margin-bottom: 10px;
  padding: 5px 10px;
  box-sizing: border-box;
  background-color: #fff;
  height: auto;
}

.img {
  margin-bottom: 10px;
  break-inside: avoid;
}
.yugao {
  width: 100%;
  box-sizing: border-box;
  background-color: #fff;
  height: auto;
  .yu {
    width: 100%;
    font-size: 14px;
    box-sizing: border-box;
    margin: 0 0 10px 0;
    overflow: hidden;
    background-color: #f9f7f7;
    border-radius: 10px;
    img {
      width: 100%;
      display: block;
      height: auto;
    }
    .title {
      color: #666;
      font-size: 14px;
    }
    .di {
      display: flex;
      justify-content: space-between;
      margin: 10px;
      line-height: 20px;
      .di1 {
        display: flex;
        .tou {
          width: 20px;
          height: 20px;
          margin-right: 5px;
          overflow: hidden;
        }
        .text {
          width: 66px;
        }
      }
    }
  }
}
</style>